<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
    <script language="JavaScript" type="text/javascript">
        function clickreback(name) {
            document.getElementById("hidelink").click();
            //j_id204:j_id205:j_id508 j_id204:j_id205:j_id510
            var arr = name.split(":");
            //if(arr.length>0){
            //var newname=arr[2].substring(4,arr[2].length)-1;
            // document.getElementById(arr[0]+":"+arr[1]+":j_id"+newname.toString()).click();
            //}
        }
    </script>
    <style type="text/css">
        .top{
            vertical-align: top; 
            padding-right: 20px;
        }
    </style>
    <h:panelGrid columns="2" columnClasses="top,top" style="height: 200px">
        <h:panelGroup>
            <rich:extendedDataTable value="#{checkFlowBean.levellist}" var="cap"
                                    id="table" rowKeyVar="index"
                                    style="width:230px;max-height:180px;"
                                    selectionMode="single"
                                    selection="#{checkFlowBean.levelselection}"
                                    noDataLabel="无数据!">
                <f:facet name="header">级次</f:facet>
                <rich:column>
                    <f:facet name="header">
                        <h:panelGroup>
                            <a4j:commandLink value="点击增行" action="#{checkFlowBean.add}" render="table" />
                        </h:panelGroup>
                    </f:facet>
                    <h:outputText value="#{cap.level}级" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">操作</f:facet>
                    <a4j:commandLink value="删除 / " render="table" action="#{checkFlowBean.remove(index)}"/>
                    <a4j:commandLink value="添加审批人"
                                     onclick="#{rich:component('personliPanel')}.show();"
                                     render="personPopupPanel,selectionchange"
                                     action="#{checkFlowBean.levelliSelected(index)}">
                    </a4j:commandLink>
                </rich:column>
                <a4j:ajax render="selectiontable"
                          listener="#{checkFlowBean.takeSelection_model}"
                          event="selectionchange"/>
            </rich:extendedDataTable>
        </h:panelGroup>
        <h:panelGroup>
            <rich:extendedDataTable rowKeyVar="rkv"
                                    style="width:220px;max-height:180px;"
                                    value="#{checkFlowBean.currentItem.nodes}"
                                    var="sel"
                                    id="selectiontable"
                                    noDataLabel="无数据!!">
                <f:facet name="header">
                    <h:outputText value="#{checkFlowBean.m+1}级 " rendered="#{checkFlowBean.m != -1}"/>
                    人员列表
                </f:facet>
                <rich:column>
                    <f:facet name="header">审批人</f:facet>
                    <h:outputText value="#{sel.name}" />
                    <h:inputHidden value="#{sel.id}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">操作</f:facet>
                    <a4j:commandLink value="删除" action="#{checkFlowBean.deleteNode}" render="selectiontable">
                        <a4j:param value="#{rkv}" assignTo="#{checkFlowBean.personIndex}"/>
                    </a4j:commandLink>
                </rich:column>
            </rich:extendedDataTable>
        </h:panelGroup>
    </h:panelGrid>
    <a4j:commandButton value="完成"  style="float:none"
                       onclick="clickreback(this.name);"
                       action="#{checkFlowBean.save}"
                       render="outpanel,err2,selectid,treemodel,tableGroup">
    </a4j:commandButton>
</ui:composition>